home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / tpdb314.arc / SORTDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1991-01-30  |  727b  |  25 lines

  1. PROGRAM SortDemo;
  2. {TPDB Version 3.14}
  3. {Copyright 1991 Brian Corll}
  4.  
  5. Uses Crt,TPDB,TPDBSort,TPDBStr;
  6.  
  7.  
  8. {Declare a FAR function which creates the sort key expression.}
  9. {This function MUST call the SortFile object, as shown.}
  10. {$F+}
  11. FUNCTION MakeKey : DBKey;{This function MUST return the type DBKey !}
  12. BEGIN
  13.         MakeKey := Substr(For2Eng(SortFile^.Field(1),ForTable,EngTable),1,1);
  14. END;
  15. {$F-}
  16.  
  17. BEGIN
  18. Writeln('Sorting TEST.DBF to SORT.DBF....');
  19.         {Set the VAR SortFunc equal to the sort key function.}
  20.         SortFunc := MakeKey;
  21.         {Then call the sort with the SortFunc VAR and the input and output files.}
  22.         SortOn(SortFunc,'test.dbf','sort.dbf');
  23. Writeln('Sort complete !');
  24. END.
  25.